Ruby - 字符串占位符

Ruby中的字符串占位符的替换值是操作字符串的常用方法,使用#进行变量或者ruby代码的求值,从而替换结果插入字符串中

1
2
3
4
5
6
7
#/usr/bin/env  ruby

book_mark = "znw123"
# following replace and insert
puts "The book mark is #{book_mark}"
#following run ruby code, string length and insert
puts "The book mark length is #{book_mark.length}"